<?php
include '../connect/common_start.php';

if (isset($_REQUEST['mem_id'])) {
	$mem_id=$_REQUEST['mem_id'];
	if (isset($_REQUEST['post_id'])) {
		$post_id=$_REQUEST['post_id'];
		$cmid=$_REQUEST['cmid'];
		$content=$_REQUEST['content'];
		$result=mysql_query("INSERT INTO `comment` (`id_mem`, `id_post`, `cm_id`, `cm_content`, `date`, `status`) VALUES ('$mem_id', '$post_id', '$cmid', '$content',NOW(),'1')");
		$rs=mysql_affected_rows();
		if($rs>0)
		{
			$sql="UPDATE `post` SET `comments`=`comments`+'1' WHERE (`id`='$post_id')";
			$result1=mysql_query($sql);
		}
		echo $rs;
	}
}
include '../connect/common_end.php';
?>